
import axios from "axios";
import { useUserStore } from "../store/user";
const request=axios.create({
  baseURL:'/dev',
  timeout:20000
});

request.interceptors.request.use((config)=>{
  const useStore=useUserStore();
  let token=useStore.token
  if(token){
    config.headers.token = token
  }

  return config
});

request.interceptors.response.use(
  (response)=>{
     return response.data
  },
  (error)=>{
    return Promise.reject(error);
  }
  );


  export default request
